<?php
/**
 *User :门前一棵柿子树
 *Date:2024/4/14
 *Email:785313152@qq.com
 */

namespace app\index\model;

use app\admin\model\ProposeClassify;
use app\common\model\Leader;
use app\common\model\Manager;
use app\common\model\Message;
use app\common\model\Work;
use think\Model;

class Propose extends Model
{


    public function setCreateUserInfoAttr($value)
    {
        if ($value) {
            return json_encode($value, 256);
        }
        return '';
    }

    public function getCreateUserInfoAttr($value)
    {
        if ($value) {
            return json_decode($value, true);
        }
        return [];
    }

    public function setLeaderUserInfoAttr($value)
    {
        if ($value) {
            return json_encode($value, 256);
        }
        return '';
    }

    public function getLeaderUserInfoAttr($value)
    {
        if ($value) {
            return json_decode($value, true);
        }
        return [];
    }

    public function setClassUserInfoAttr($value)
    {
        if ($value) {
            return json_encode($value, 256);
        }
        return '';
    }

    public function getClassUserInfoAttr($value)
    {
        if ($value) {
            return json_decode($value, true);
        }
        return [];
    }

    public function setHrUserInfoAttr($value)
    {
        if ($value) {
            return json_encode($value, 256);
        }
        return '';
    }

    public function getHrUserInfoAttr($value)
    {
        if ($value) {
            return json_decode($value, true);
        }
        return [];
    }

    public function setSolutionUserInfoAttr($value)
    {
        if ($value) {
            return json_encode($value, 256);
        }
        return '';
    }

    public function getSolutionUserInfoAttr($value)
    {
        if ($value) {
            return json_decode($value, true);
        }
        return [];
    }

    public function getPropsoeTypeTextAttr($value, $data)
    {
        return ProposeClassify::where('id', '=', $data['propose_type'])->value('name');
    }

}